home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / MotifApp / ch6 / HelloWindow.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  1.7 KB  |  62 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //         This example code is from the book:
  4. //
  5. //           Object-Oriented Programming with C++ and OSF/Motif
  6. //         by
  7. //           Douglas Young
  8. //           Prentice Hall, 1992
  9. //           ISBN 0-13-630252-1    
  10. //
  11. //         Copyright 1991 by Prentice Hall
  12. //         All Rights Reserved
  13. //
  14. //  Permission to use, copy, modify, and distribute this software for 
  15. //  any purpose except publication and without fee is hereby granted, provided 
  16. //  that the above copyright notice appear in all copies of the software.
  17. ///////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. /////////////////////////////////////////////////////////////
  22. // HelloWindow.C: "Hello World" main window
  23. ///////////////////////////////////////////////////////////////
  24. #include <signal.h>
  25. #include <stdio.h>
  26.  
  27. #include "HelloWindow.h"
  28. #include <Xm/Label.h>
  29.  
  30. extern void hiho(int sig);
  31.  
  32. Status x;
  33.  
  34. Widget HelloWindow::createWorkArea ( Widget parent )
  35. {
  36.     
  37.     // Create a compound string to display the Hello message
  38.     
  39.     XmString xmstr = XmStringCreateSimple ( "Hello World" );
  40.     
  41.     // Create a label widget to display the string
  42.     
  43.     Widget label = XtVaCreateWidget ( "label", 
  44.                      xmLabelWidgetClass,
  45.                      parent, 
  46.                      XmNlabelString, xmstr,
  47.                      NULL );
  48.     
  49.     // Free the compound string when it is no longer needed.
  50.     
  51.     XmStringFree ( xmstr );
  52.  
  53.     sigset(SIGUSR2, hiho);
  54.     return label;
  55. }
  56.  
  57. void
  58. hiho(int sig)
  59. {
  60.     printf("hi ho %d\n", sig);
  61. }
  62.